package aaa.analyzer;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Locale;

public class Feed {
	private long guid;
	private String title;
	private String description;
	private String pubDate;

	public Feed(long guid, String title, String description, String pubDate) {
		super();
		this.guid = guid;
		this.title = title;
		this.description = description;
		this.pubDate = pubDate;	
	}


	public Feed() {
		super();
	}

	public long getId() {
		return this.guid;
	}

	public void setId(long id) {
		this.guid = id;
	}

	public String getTitle() {
		return this.title;
	}
	public void setTitle(String title) {
		this.title = title;
	}

	public String getPubDate() {
		return this.pubDate;
	}
	
	private static SimpleDateFormat dateFormatter = new SimpleDateFormat("EEEE dd MMMM HH:mm", Locale.FRANCE) ;
	private static SimpleDateFormat dateParser = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US) ; 
	
	public void setPubDate(String pubDate) {
		try {
			this.pubDate = Feed.dateFormatter.format(Feed.dateParser.parse(pubDate)) ;
		} catch (ParseException e) {
			//TODO Add AAAInternal error
		}
	}

	public String getDescription() {
		return this.description;
	}
	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public String toString() {
		return "Feed :\n[Guid=" + this.guid +"\nCours=" + this.title +"\nDescription=" + this.description + "\npubDate=" + this.pubDate + "]";
	}


}
